
import { createMemoryHistory } from "history";
import { Router, Route, Redirect, Switch } from "react-router-dom";
import lazy from 'utils/lazy';

const Demo1 = lazy(() => import('pages/Demo1'));
const Demo2 = lazy(() => import('pages/Demo2'));

export default function App(props) {
  return (
    <Router history={props.history || createMemoryHistory()} >
      <Switch>
        <Route path="/demo1" component={Demo1} />
        <Route path="/demo2" component={Demo2} />
        <Route render={() => <Redirect to="/demo1" />} />
      </Switch>
    </Router>
  );
}